package net.alpcontrol.bi.colligation.service.impl;

import net.alpcontrol.bi.colligation.entity.PjProjectOps;
import net.alpcontrol.bi.colligation.entity.PjProjectProfit;
import net.alpcontrol.bi.colligation.mapper.PjOpsProjectProblemMapper;
import net.alpcontrol.bi.colligation.mapper.PjProjectOpsMapper;
import net.alpcontrol.bi.colligation.mapper.PjProjectProfitMapper;
import net.alpcontrol.bi.colligation.service.IPjProjectOpsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 丛庆
 * @since 2020-09-11
 */
@Service
@Transactional
public class PjProjectOpsServiceImpl extends ServiceImpl<PjProjectOpsMapper, PjProjectOps> implements IPjProjectOpsService {

    @Autowired
    private PjProjectOpsMapper pjProjectOpsMapper;

    @Autowired
    private PjProjectProfitMapper pjProjectProfitMapper;
    @Autowired
    private PjOpsProjectProblemMapper pjOpsProjectProblemMapper;

    /**
      *  分页查询
      * @param bootStrapTable
      * @param pjProjectOps
      * @return
      */
    @Override
    public IPage<PjProjectOps> selectPage(Page<PjProjectOps> page) {
        return pjProjectOpsMapper.selectPage(page,null);
    }

    @Override
    public Map getKpiByXmbm(String xmbm) {
        Map result = new HashMap();
        //利润
        result.put("profit",pjProjectProfitMapper.getPjProfitByXmbm(xmbm));
        //运维
        result.put("opt",pjProjectOpsMapper.getPjKpiByXmbm(xmbm));
        //预警
        result.put("problem",pjOpsProjectProblemMapper.getPjProblemsByXmbm(xmbm));
        return result;
    }
}
